/*
 * Project Name: jmax
 * File Name: FilterRuleServiceImpl.java
 * Copyright: Copyright(C) 1985-2015 ZKTeco Inc. All rights reserved.
 */
package com.xdtech.sys.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xdtech.core.model.BaseItem;
import com.xdtech.sys.dao.FilterRuleDao;
import com.xdtech.sys.model.FilterRule;
import com.xdtech.sys.service.FilterRuleService;
import com.xdtech.web.model.Pagination;

/**
 * TODO 一句话功能简述，请确保和下面的block tags之间保留一行空行
 * <p>
 * TODO 功能详细描述，若不需要请连同上面的p标签一起删除
 * 
 * @author <a href="max.zheng@zkteco.com">郑志雄</>
 * @version TODO 添加版本
 * @see 相关类或方法，不需要请删除此行
 * @since 2015-3-19 上午9:26:58
 */
@Service
public class FilterRuleServiceImpl implements FilterRuleService
{
	@Autowired
	private FilterRuleDao filterRuleDao;
	/* (非 Javadoc)
	 * save
	 * <p>对override方法的补充说明，若不需要则删除此行</p>
	 * 
	 * @param entity
	 * @see com.xdtech.common.service.IBaseService#save(com.xdtech.core.model.BaseModel)
	 */
	@Override
	public void save(FilterRule entity)
	{
		filterRuleDao.save(entity);
	}

	/* (非 Javadoc)
	 * saveAll
	 * <p>对override方法的补充说明，若不需要则删除此行</p>
	 * 
	 * @param entities
	 * @see com.xdtech.common.service.IBaseService#saveAll(java.util.List)
	 */
	@Override
	public void saveAll(List<FilterRule> entities)
	{
		filterRuleDao.saveAll(entities);
	}

	/* (非 Javadoc)
	 * delete
	 * <p>对override方法的补充说明，若不需要则删除此行</p>
	 * 
	 * @param entity
	 * @see com.xdtech.common.service.IBaseService#delete(com.xdtech.core.model.BaseModel)
	 */
	@Override
	public void delete(FilterRule entity)
	{
		filterRuleDao.delete(entity);
	}

	/* (非 Javadoc)
	 * delete
	 * <p>对override方法的补充说明，若不需要则删除此行</p>
	 * 
	 * @param id
	 * @see com.xdtech.common.service.IBaseService#delete(java.lang.Long)
	 */
	@Override
	public void delete(Long id)
	{
		filterRuleDao.delete(id);
	}

	/* (非 Javadoc)
	 * get
	 * <p>对override方法的补充说明，若不需要则删除此行</p>
	 * 
	 * @param id
	 * @return
	 * @see com.xdtech.common.service.IBaseService#get(java.lang.Long)
	 */
	@Override
	public FilterRule get(Long id)
	{
		return filterRuleDao.get(id);
	}

	/* (非 Javadoc)
	 * getAll
	 * <p>对override方法的补充说明，若不需要则删除此行</p>
	 * 
	 * @return
	 * @see com.xdtech.common.service.IBaseService#getAll()
	 */
	@Override
	public List<FilterRule> getAll()
	{
		return filterRuleDao.getAll();
	}

	/* (非 Javadoc)
	 * loadPageAndCondition
	 * <p>对override方法的补充说明，若不需要则删除此行</p>
	 * 
	 * @param pg
	 * @param values
	 * @return
	 * @see com.xdtech.common.service.IBaseService#loadPageAndCondition(com.xdtech.web.model.Pagination, java.util.Map)
	 */
	@Override
	public Map<String, Object> loadPageAndCondition(Pagination pg, Map<String, String> values)
	{
		return null;
	}

	/* (非 Javadoc)
	 * deleteByGroupId
	 * <p>对override方法的补充说明，若不需要则删除此行</p>
	 * 
	 * @param id
	 * @see com.xdtech.sys.service.FilterRuleService#deleteByGroupId(java.lang.Long)
	 */
	@Override
	public void deleteByGroupId(Long groupId)
	{
		filterRuleDao.batchExecute("delete FilterRule where filterGroup.id=?", groupId);
	}

	/* (非 Javadoc)
	 * getRuleByResourceKey
	 * <p>对override方法的补充说明，若不需要则删除此行</p>
	 * 
	 * @param key
	 * @return
	 * @see com.xdtech.sys.service.FilterRuleService#getRuleByResourceKey(java.lang.String)
	 */
	@Override
	public FilterRule getRuleByResourceKey(String key)
	{
		FilterRule rule = filterRuleDao.findUnique("from FilterRule where filterGroup.translator.resouceId=(select id from Resource where key=?)", key);
		return rule;
	}

	/**
	 * @description
	 * @author max.zheng
	 * @create 2015-4-18下午12:24:37
	 * @modified by
	 * @param pg
	 * @param baseItem
	 * @param queryName
	 * @return
	 */
	@Override
	public Map<String, Object> loadPageDataByConditions(Pagination pg,
			BaseItem baseItem, String queryName) {
		// TODO Auto-generated method stub
		return null;
	}

}
